package org.amos.gateway.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;

import java.util.*;

/**
 * @desc: Xss 配置文件
 * @author: liubt
 * @date: 2020-12-15 13:12
 **/
@Data
@Configuration
@RefreshScope
@ConfigurationProperties(prefix = XssProperties.PREFIX)
public class XssProperties {
    public static final String PREFIX = "amos.security.xss";

    /**
     * Xss开关
     */
    private Boolean enabled = true;
    /**
     * xss 需要排除的路径（Ant风格）
     */
    private List<String> excludeUrls = Collections.EMPTY_LIST;
    /**
     * 需要处理的 HTTP 请求方法集合
     */
    private final Set<String> includeHttpMethods = new HashSet<>(
            Arrays.asList(HttpMethod.POST.name(), HttpMethod.PUT.name(), HttpMethod.PATCH.name()));

}
